/*******************************************************************************
 * Copyright 2011-2012 Dik Grapendaal
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 ******************************************************************************/
package sh.grapendaal.tsuushin.message;

/**
 * This enum contains all known message types of the IRC protocol.
 */

public enum MessageType {
	JOIN, MODE, NICK, PART, PING, PONG, QUIT, TOPIC,
	
	WELCOME_MESSAGE("001"),
	NICKNAME_IN_USE("433"),
	
	/**
	 * A PRIVMSG directed to the current user.
	 */
	PRIVATE_MESSAGE("PRIVMSG"),

	/**
	 * A PRIVMSG directed to a channel.
	 */
	CHANNEL_MESSAGE("PRIVMSG"),

	/**
	 * A NOTICE directed to the current user.
	 */
	PRIVATE_NOTICE("NOTICE"),

	/**
	 * A NOTICE directed to a channel.
	 */
	CHANNEL_NOTICE("NOTICE"),
	
	/**
	 * Some message.
	 */
	UNKNOWN;
	
	private String command;
	
	private MessageType() {
	}
	
	private MessageType(String event) {
		this.command = event;
	}
	
	@Override
	public String toString() {
		if (command == null) {
			return super.toString();
		}
		return command;
	}
}
